INSERT INTO SASALD01 
            ( I_YEAR,N_SEQ,I_CLIENT,I_SO_TYPE,I_SO_NO,I_SO_ITEM,I_SALES_ORG,
              I_DIVISION,I_DIST_CHN,I_ACCT_ASSN,I_MATERIAL,I_PLANT,I_CUSTOMER,
              D_SO,Q_SO,I_DELI_NO,I_DELI_ITEM,D_GI,Q_GI,I_INV_NO,I_INV_ITEM,
              D_INV,Q_INV,I_CURRENCY,Q_AMOUNT,I_CRE_USER,D_CREATE,N_MATERIAL ) 
SELECT TO_CHAR(SYSDATE,'YYYY'),S_SASALD01.NEXTVAL,A.ZMANDT,A.ZAUART,A.ZVBELN,
       A.ZPOSNR,A.ZVKORG,A.ZSPART,A.ZVTWEG,A.ZKTGRD,A.ZMATNR,A.ZWERKS,
       DECODE(A.ZZKUNNR2,' ',A.ZKUNNR,A.ZZKUNNR2),A.ZMBDAT,A.ZKWMENG,C.ZVBELN,
       C.ZPOSNR,C.ZWADAT_IS,C.ZLFIMG,D.ZVBELN,D.ZPOSNR,D.ZFKDAT,D.ZFKIMG,
       D.ZWAERK,DECODE(D.ZWAERK,'KRW',D.ZNETWR * 100 ,'JPY',D.ZNETWR * 100 ,
       'ITL',D.ZNETWR * 100 ,'KWD',D.ZNETWR * 0.1 ,'BHD',D.ZNETWR * 0.1 ,D.ZNETWR),
       'COSMOS',SYSDATE,E.ZMAKTX 
  FROM MQM.AZVVBEP A,
       MQM.AZVLIPS C,
       (SELECT ZMANDT,ZVBELN,ZPOSNR,ZFKDAT,ZFKIMG,ZNETWR,ZCMPRE,ZWAERK,ZVGBEL,
               ZVGPOS,ZAUBEL,ZAUPOS 
          FROM MQM.AZVVBRP 
         WHERE ZFKSTO = ' ' 
           AND ZSFAKN = ' ' ) D,
       MQM.PZMATNR E 
 WHERE A.ZMANDT = C.ZMANDT (+) 
   AND A.ZVBELN = C.ZVGBEL (+) 
   AND A.ZPOSNR = C.ZVGPOS (+)    
   AND C.ZMANDT = D.ZMANDT (+)    
   AND C.ZVBELN = D.ZVGBEL (+)    
   AND C.ZPOSNR = D.ZVGPOS (+)    
   AND A.ZMANDT = E.ZMANDT  
   AND A.ZMATNR = E.ZMATNR  
   AND A.ZETENR = '0001'  
   AND A.ZMANDT = :b1  
   AND A.ZVBELN = :b2  
   AND A.ZPOSNR = :b3
/
